#include <QtCore/QString>
#include <QtCore/QDebug>
+#include <QtCore/QTextStream>
# include "src/core/datetime.h"
extern time_t gpsbabel_now; /* gpsbabel startup-time; initialized in main.c with time() */
extern time_t gpsbabel_time; /* gpsbabel startup-time; initialized in main.c with current_time(), ! ZERO within testo ! */
extern int geocaches_present;
+extern QTextStream cerr;
#define MILLI_TO_MICRO(t) (t * 1000) /* Milliseconds to Microseconds */
#define MICRO_TO_MILLI(t) (t / 1000) /* Microseconds to Milliseconds*/
void* xrealloc(void* p, size_t s);
void xfree(const void* mem);
char* xstrdup(const char* s);
+char* xstrdup(const QString& s);
char* xstrndup(const char* s, size_t n);
char* xstrndupt(const char* s, size_t n);
char* xstrappend(char* src, const char* addon);
gep = (gpx_global_entry*) xcalloc(sizeof(*gep), 1);
QUEUE_INIT(&gep->queue);
- gep->tagdata = xstrdup(CSTR(s));
+ gep->tagdata = xstrdup(s);
ENQUEUE_TAIL(&ge->queue, &gep->queue);
}
* version.
*/
if (! gpx_version) {
- gpx_version = xstrdup(CSTR(attr.value("version").toString()));
+ gpx_version = xstrdup(attr.value("version").toString());
} else if ((strtod(gpx_version, NULL) * 10) < (attr.value("version").toString().toDouble() * 10)) {
xfree(gpx_version);
- gpx_version = xstrdup(CSTR(attr.value("version").toString()));
+ gpx_version = xstrdup(attr.value("version").toString());
}
}
/* save namespace declarations in case we pass through elements
new_tag->attributes = (char**)xcalloc(sizeof(char*),2*attr_count+1);
avcp = new_tag->attributes;
for (int i = 0; i < attr_count; i++) {
- *avcp = xstrdup(CSTR(attr[i].name().toString()));
+ *avcp = xstrdup(attr[i].name().toString());
avcp++;
- *avcp = xstrdup(CSTR(attr[i].value().toString()));
+ *avcp = xstrdup(attr[i].value().toString());
avcp++;
}
*avcp = NULL; // this indicates the end of the attribute name value pairs.
if (wpt_tmp->notes != NULL) {
xfree(wpt_tmp->notes);
}
- wpt_tmp->notes = xstrdup(CSTR(cdatastr));
+ wpt_tmp->notes = xstrdup(cdatastr);
break;
case tt_cache_container:
waypt_alloc_gc_data(wpt_tmp)->container = gs_mkcont(cdatastr);
* Route-specific tags.
*/
case tt_rte_name:
- rte_head->rte_name = xstrdup(CSTR(cdatastr));
+ rte_head->rte_name = xstrdup(cdatastr);
break;
case tt_rte:
break;
wpt_tmp = NULL;
break;
case tt_rte_desc:
- rte_head->rte_desc = xstrdup(CSTR(cdatastr));
+ rte_head->rte_desc = xstrdup(cdatastr);
break;
case tt_rte_number:
rte_head->rte_num = cdatastr.toInt();
* Track-specific tags.
*/
case tt_trk_name:
- trk_head->rte_name = xstrdup(CSTR(cdatastr));
+ trk_head->rte_name = xstrdup(cdatastr);
break;
case tt_trk:
break;
wpt_tmp = NULL;
break;
case tt_trk_desc:
- trk_head->rte_desc = xstrdup(CSTR(cdatastr));
+ trk_head->rte_desc = xstrdup(cdatastr);
break;
case tt_trk_number:
trk_head->rte_num = cdatastr.toInt();
case tt_wpt_name:
case tt_rte_rtept_name:
case tt_trk_trkseg_trkpt_name:
- wpt_tmp->shortname = xstrdup(CSTR(cdatastr));
+ wpt_tmp->shortname = xstrdup(cdatastr);
break;
case tt_wpt_sym:
case tt_rte_rtept_sym:
case tt_wpt_cmt:
case tt_rte_rtept_cmt:
case tt_trk_trkseg_trkpt_cmt:
- wpt_tmp->description = xstrdup(CSTR(cdatastr));
+ wpt_tmp->description = xstrdup(cdatastr);
break;
case tt_wpt_desc:
case tt_trk_trkseg_trkpt_desc:
if (wpt_tmp->notes != NULL) {
xfree(wpt_tmp->notes);
}
- wpt_tmp->notes = xstrdup(CSTR(cdatastr));
+ wpt_tmp->notes = xstrdup(cdatastr);
break;
case tt_pdop:
wpt_tmp->pdop = cdatastr.toDouble();
if (html_encrypt && encoded) {
s = rot13(logpart->cdata);
} else {
- s = xstrdup(CSTR(logpart->cdata));
+ s = xstrdup(logpart->cdata);
}
t = html_entitize(s);
if (html_encrypt && encoded) {
s = rot13(logpart->cdata);
} else {
- s = xstrdup(CSTR(logpart->cdata));
+ s = xstrdup(logpart->cdata);
}
r = r + "<br />";
if (a.hasAttribute("cache_id")) {
int n = a.value("cache_id").toString().toInt();
QString fn = QString("N%1").arg(n, 5, 16, QChar('0'));
- wpt_tmp->shortname = xstrdup(CSTR(fn));
+ wpt_tmp->shortname = xstrdup(fn);
UrlLink l(QString(NC_URL) + QString::number(n));
wpt_tmp->AddUrlLink(l);
}
if (a.hasAttribute("name")) {
- wpt_tmp->description = xstrdup(CSTR(a.value("name").toString()));
+ wpt_tmp->description = xstrdup(a.value("name").toString());
}
if (a.hasAttribute("user_name")) {
gc_data->placer = a.value("user_name").toString();
if (txt_encrypt && encoded) {
s = rot13(logpart->cdata);
} else {
- s = xstrdup(CSTR(logpart->cdata));
+ s = xstrdup(logpart->cdata);
}
gbfprintf(file_out, "%s", s);
return o;
}
+char* xstrdup(const QString& s)
+{
+ return xstrdup(CSTR(s));
+}
+
/*
* Duplicate at most sz bytes in str.
*/
char tag[8];
unsigned short int taglen = 0;
- incopy = instr = xstrdup(CSTR(in->utfstring));
+ incopy = instr = xstrdup(in->utfstring);
if (!in->is_html) {
return instr;
}
/*
* We only shorten, so just dupe the input buf for space.
*/
- outstring = out = xstrdup(CSTR(in->utfstring));
+ outstring = out = xstrdup(in->utfstring);
tag[0] = 0;
while (*instr) {